<%--
  Created by IntelliJ IDEA.
  User: kuibu
  Date: 16/2/25
  Time: 下午9:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>注册丨跬步</title>
    <link rel="stylesheet" href="http://www.kuibutech.com/kuibuversion1/css/style.css">
    <link type="image/x-icon" rel="shortcut icon" href="http://img.kuibutech.com/kbApp_fixedImage/favicon.ico"/>

    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>

    <link rel="stylesheet" type="text/css" href="http://www.kuibutech.com/kuibuversion1/css/sweetalert.css">
    <script src="http://www.kuibutech.com/kuibuversion1/js/sweetalert.min.js"></script>

    <script>
        function sb(){
            var form = document.getElementById("registerForm");
            var tel = document.getElementsByName("telnumber");
            var psd = document.getElementsByName("password");
            var psd2 = document.getElementsByName("password2");
            var inv = document.getElementById("invite").value;
            var conform = document.getElementById("yanzhengma").value;
            var corrcetyan = document.getElementById("correctyan").value;
            telnum = tel[0].value;
            pwd = psd[0].value;
            pwd2 = psd2[0].value;

            if(conform==""){
                swal({
                    title: "",
                    text: "<span style=\"color:red;font-size: 20px\">验证码不能为空<span>",
                    html: true,
                    allowOutsideClick:true,
                    showConfirmButton:true
                });
                return false;
            }else if(conform != corrcetyan){
                swal({
                    title: "",
                    text: "<span style=\"color:red;font-size: 20px\">验证码不正确<span>",
                    html: true,
                    allowOutsideClick:true,
                    showConfirmButton:true
                });
                return false;
            }

            if(inv==""){
                inv = "null";
            }



            if(telnum==""||pwd==""||pwd2==""){
//                alert("信息填写不完整")
                swal({
                    title: "注册失败",
                    text: "<span style=\"color:red;font-size: 20px\">\"信息填写不完整！\"<span>",
                    html: true,
                    allowOutsideClick:true,
                    showConfirmButton:true
                });
                return false;
            }else if(pwd != pwd2){
                swal({
                    title: "注册失败",
                    text: "<span style=\"color:red;font-size: 20px\">\"密码输入不一致！\"<span>",
                    html: true,
                    allowOutsideClick:true,
                    showConfirmButton:true
                });
                return false;
            }else{
                form.setAttribute("action","/kuibuversion1/user/htmlRegister/"+telnum+"/"+pwd+"/"+inv);
                form.submit();
            }

        }

        function getYan(){
            var yanzheng = document.getElementById("correctyan");
            var tel = document.getElementsByName("telnumber");
            telnum = tel[0].value;
            var yanbtn = document.getElementById("yanzheng");
            yanbtn.innerHTML = "已发送";
            yanbtn.setAttribute("disabled","true");
            $.post("/kuibuversion1/user/getHtmlConfirmCode/" + telnum,{},function(data){
                yanzheng.value = data.confirmCode;
            })
        }

    </script>
</head>

<body style="background-image: url(http://kuibutech.oss-cn-shanghai.aliyuncs.com/kbApp_fixedImage/loginBgPic.jpg);background-repeat:no-repeat;background-attachment:fixed;background-position:50% 50%">

<div class="login-container">

    <h1>跬步</h1>

    <div class="connect">
        <p>走好大学每一步</p>
    </div>

    <form action="/kuibuversion1/user/register" method="post" id="registerForm">
        <div>
            <input type="text" name="telnumber" class="username" placeholder="手机号" autocomplete="off"/>
        </div>
        <div style="width: 305px;">
            <input type="text" id="yanzhengma" name="yanzhengma" style="width: 140px;margin-left: 0;" placeholder="验证码" autocomplete="off"/>
            <input hidden id="correctyan" value="">
            <button id="yanzheng" type="button" onclick="getYan()" style="width: 120px">获取验证码</button>
        </div>
        <div>
            <input type="password" name="password" class="password" placeholder="密码" oncontextmenu="return false" onpaste="return false" />
        </div>
        <div>
            <input type="password" name="password2" class="password" placeholder="再次输入密码" oncontextmenu="return false" onpaste="return false" />
        </div>
        <div>
            <input id="invite" type="text" name="telnumber" class="username" placeholder="邀请码（可不填）" autocomplete="off"/>
        </div>
        <button id="register" type="button" onclick="sb()">注 册</button>
    </form>

</div>

</body>

</html>
